<div class="container-fluid py-5">
    <div class="row">
        <div class="col-12">
            <div class="jumbotron jumbotron-small bg-light mat-elevation-z5 mb-0">
                <div class="jumbotron-heading">
                    <div>
                        <h2 class="shadowed">Resource Inventory</h2>
                        <p class="shadowed">View and manage Resource Inventory</p>
                    </div>
                    <!-- <button type="button" class="btn btn-success btn-lg" routerLink='/resource'>
                        <i class="fas fa-clipboard-list mr-2"></i>Create New Resource
                    </button> -->
                </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="name">
                            <th mat-header-cell *matHeaderCellDef mat-sort-header> Name </th>
                            <td mat-cell *matCellDef="let element"><a
                                    routerLink='/{{appService.portalDomain}}/resource/{{element.id}}'>{{element.name}}</a></td>
                        </ng-container>
                        <ng-container matColumnDef="@type">
                            <th mat-header-cell *matHeaderCellDef mat-sort-header> Type </th>
                            <td mat-cell *matCellDef="let element">{{element['@type']}}</td>
                        </ng-container>
                        <ng-container matColumnDef="category">
                            <th mat-header-cell *matHeaderCellDef mat-sort-header> Category </th>
                            <td mat-cell *matCellDef="let element">{{element.category}}</td>
                        </ng-container>

                        <ng-container matColumnDef="resourceStatus">
                            <th mat-header-cell *matHeaderCellDef mat-sort-header> Status </th>
                            <td mat-cell *matCellDef="let element">{{element.resourceStatus}}</td>
                        </ng-container>
                    
                        <ng-container matColumnDef="startOperatingDate">
                            <th mat-header-cell *matHeaderCellDef mat-sort-header> Starting Operating Date </th>
                            <td mat-cell *matCellDef="let element">{{element.startOperatingDate | date:'d MMM y, h:mm a'}}</td>
                        </ng-container>

                        <ng-container matColumnDef="actions">
                            <th mat-header-cell *matHeaderCellDef>Actions</th>
                            <td mat-cell *matCellDef="let element">
                                <a routerLink='/{{appService.portalDomain}}/resource/{{element.id}}'>
                                    <button class="btn btn-warning btn-sm m-1"><i class="far fa-edit"></i></button>
                                </a>                                
                                <button class="btn btn-danger btn-sm m-1" (click)="openResourceDeleteDialog(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]="[30, 50, 100]" showFirstLastButtons></mat-paginator>

                </div>
            </div>
        </div>
    </div>
</div>
