<div class="container-fluid py-5">
    <div class="row">
        <div class="col-12">
            <div class="jumbotron jumbotron-small jumbotron-list-container bg-light mat-elevation-z5 mb-0">
                <div class="jumbotron-heading align-items-center justify-content-between row ">
                    <div class="col-md-6">
                        <h2 class="shadowed">Alarms</h2>
                        <p class="shadowed">View and manage alarms raised by the system components</p>
                    </div>
                    <div class="col-md-6 text-md-right">
                        <button type="button" class="btn btn-success" (click)="createDummyAlarm()">
                            <i class="fas fa-clipboard-list mr-2"></i>Create Test Alarm
                        </button>
                    </div>
                </div>

                <div class="filter-container pt-3 px-3 row">
                    <!-- <input class="form-control " (keyup)="applyFilter($event.target.value)" placeholder="Apply Filter..."> -->
                    <mat-form-field appearance="" class="white-background col-12">
                        <mat-label>Apply Filter...</mat-label>
                        <input matInput (keyup)="applyFilter($event.target.value)">
                    </mat-form-field>
                </div>

                <div class="table-responsive mat-elevation-z1" [@fadeIn]>

                    <table mat-table [dataSource]="dataSource" matSort class="table table-generic">

                        <ng-container matColumnDef="sourceSystemId">
                            <th mat-header-cell *matHeaderCellDef mat-sort-header> Source System </th>
                            <td mat-cell *matCellDef="let element"> <b>{{element.sourceSystemId}}</b> </td>
                        </ng-container>

                        <ng-container matColumnDef="perceivedSeverity">
                            <th mat-header-cell *matHeaderCellDef mat-sort-header> Severity </th>
                            <!-- <td mat-cell *matCellDef="let element" ngClass="{{element.perceivedSeverity}}_alarm_color">  -->
                            <td mat-cell *matCellDef="let element"> 

                                <!-- <span class="severity_circle mr-1" ngClass="{{element.perceivedSeverity}}_alarm_bg" ></span> -->
                                <span [ngClass]="sharedAlarmService.returnSeverityIconClass(element.perceivedSeverity)"></span>
                                <b>{{element.perceivedSeverity}}</b>
                            </td>
                        </ng-container>
                        <ng-container matColumnDef="ackState">
                            <th mat-header-cell *matHeaderCellDef mat-sort-header> Ack State</th>
                            <td mat-cell *matCellDef="let element"> {{element.ackState}} </td>
                        </ng-container>

                        <ng-container matColumnDef="state">
                            <th mat-header-cell *matHeaderCellDef mat-sort-header> State </th>
                            <td mat-cell *matCellDef="let element"> 
                                <span [ngClass]="sharedAlarmService.returnStateIconClass(element.state)"></span>
                                {{element.state}} 
                            </td>
                        </ng-container>

                        <ng-container matColumnDef="alarmType">
                            <th mat-header-cell *matHeaderCellDef mat-sort-header> Type </th>
                            <td mat-cell *matCellDef="let element"> {{element.alarmType}} </td>
                        </ng-container>

                        <ng-container matColumnDef="probableCause">
                            <th mat-header-cell *matHeaderCellDef mat-sort-header> Probable Cause </th>
                            <td mat-cell *matCellDef="let element"> {{element.probableCause}} </td>
                        </ng-container>

                        <ng-container matColumnDef="alarmRaisedTime">
                            <th mat-header-cell *matHeaderCellDef mat-sort-header> Raised Time (Local Time) </th>
                            <td mat-cell *matCellDef="let element"> {{element.alarmRaisedTime | date:'d MMM y, h:mm:ss a'}} </td>
                        </ng-container>

                        <ng-container matColumnDef="actions">
                            <th mat-header-cell *matHeaderCellDef>Actions</th>
                            <td mat-cell *matCellDef="let element">
                                <button class="btn btn-warning btn-sm mr-1" routerLink='/{{appService.portalDomain}}/alarm/{{element.id}}'><i
                                        class="far fa-edit"></i></button>
                                <!-- <button class="btn btn-danger btn-sm " (click)="openCatalogDeleteDialog(element)"><i
                                        class="far fa-trash-alt"></i></button> -->
                                <button class="btn btn-danger btn-sm " (click)="openDeleteAlarmDialog(element)"><i
                                        class="far fa-trash-alt"></i></button>

                            </td>
                        </ng-container>

                        <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
                        <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
                    </table>

                    <mat-paginator [pageSizeOptions]="[50, 100, 200]" showFirstLastButtons></mat-paginator>
                </div>
            </div>
        </div>
    </div>
</div>