<!--

    Copyright (C) 2015-2016 Jeeva Kandasamy (jkandasa@gmail.com)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

            http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->

<div class="container-fluid"> <!-- Container-fluid -->

  <!-- Loading icon disaplay -->
  <div ng-if="!orgList.$resolved">
    <div ng-include src="'partials/common-html/loading.html'"></div>
  </div>

  <div ng-if="orgList.$resolved"> <!-- Main Message -->

    <!-- Page Header -->
    <div ng-include src="'partials/common-html/header-list.html'"></div>

    <div class="col-md-12">
      <div class="btn-toolbar pull-right" role="toolbar">
        <!-- Single button -->
        <div class="btn-group" role="group">
          <a ng-class="{'disabled': !itemName}" class="btn btn-primary" type="button" ng-click="editItem()"><i class="fa fa-lg fa-edit"></i> {{ 'EDIT' | translate }}</a></a>
        </div>
      </div>
      <div pf-filter id="itemsFilter" config="filterConfig" ng-show="orgList.length > 0"></div>
    </div>

    <!-- Display When no data on table -->
    <div ng-if="orgList.length > 0 && filteredList.length == 0">
      <legend></legend>
      <div class="blank-slate-pf" >
        <div class="blank-slate-pf-icon">
          <i class="fa fa-exclamation-triangle"></i>
        </div>
        <h1>{{ 'NO_ITEMS_IN_FILTER' | translate }}</h1>
      </div>
    </div>

    <div ng-if="filteredList.length > 0">
      <!-- Table -->
      <table class="table table-hover table-bordered table-striped mc-table">
        <thead>
          <th class="col-md-1">{{ 'SENSOR_TYPE' | translate }}</th>
          <th class="col-md-11">{{ 'VARIABLES' | translate }}</th>
        </thead>
        <tbody>
          <tr dir-paginate="item in filteredList | orderBy:'displayName' | itemsPerPage: query.pageLimit" pagination-id="variable-mapper" ng-click="selectItem(item)" ng-class="{'mc-selected': itemName === item.displayName}" >
            <td class="col-md-1">{{item.displayName}}</td>
            <td class="col-md-11">{{item.value.join(', ')}}</td>
          </tr>
        </tbody>
      </table>
      <dir-pagination-controls class="pull-right" boundary-links="true" pagination-id="variable-mapper"></dir-pagination-controls>
    </div>

  </div> <!-- Main Message -->

</div> <!-- Container-fluid -->
