{{!
  Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.

  WSO2 Inc. licenses this file to you 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.
}}

{{unit "cdmf.unit.ui.title" pageTitle="Device Management"}}

{{unit "cdmf.unit.data-tables-extended"}}
{{unit "cdmf.unit.lib.qrcode"}}
{{unit "mdm.unit.device.qr-modal"}}

{{#zone "breadcrumbs"}}
    <li>
        <a href="{{@app.context}}/">
            <i class="icon fw fw-home"></i>
        </a>
    </li>
    <li>
        <!--suppress HtmlUnknownTarget -->
        <a href="{{@app.context}}/devices">
            Devices
        </a>
    </li>
{{/zone}}

{{#zone "navbarActions"}}
    {{#if permissions.ENROLL_DEVICE}}
        <li id="enroll-btn" class="hidden">
            <a href="javascript:toggleEnrollment()">
                <span class="fw-stack">
                    <i class="fw fw-ring fw-stroke fw-stack-2x"></i>
                    <i class="fw fw-add fw-stack-1x"></i>
                </span>
                &nbsp;&nbsp;Add New Device
            </a>
        </li>
    {{/if}}
    {{#if permissions.ADVANCED_SEARCH}}
        <li id="advanced-search-btn" class="hidden">
            <a href="{{@app.context}}/devices/search">
                <span class="fw-stack">
                    <i class="fw fw-ring fw-stroke fw-stack-2x"></i>
                    <i class="fw fw-search fw-stack-1x"></i>
                </span>
                &nbsp;&nbsp;Advanced Search
            </a>
        </li>
    {{/if}}
{{/zone}}

{{#zone "content"}}
    {{#if permissions.VIEW_DEVICES}}
        <div id="no-device-view" class="ast-container list-view hidden">
            <div class="ctrl-info-panel col-centered text-center wr-login">
                <h3 class="text-muted">
                    <i class="fw fw-mobile fw-3x"></i>
                </h3>
                <h3 class="text-muted">You do not have any enrolled device at the moment</h3>
                <h3>
                    <a href="javascript:toggleEnrollment()" class="btn-operations btn-default">
                        <span class="fw-stack">
                            <i class="fw fw-ring fw-stack-2x"></i>
                            <i class="fw fw-add fw-stack-1x"></i>
                        </span>
                        &nbsp;&nbsp;Add New Device
                    </a>
                </h3>
            </div>
        </div>
        <div id="device-table" class="hidden">
            <table id="device-grid"
                class="table table-striped table-hover list-table display responsive nowrap data-table grid-view">
                <thead>
                    <tr class="sort-row">
                        <th class="no-sort"></th>
                        <th>By Device Name</th>
                        <th>By Owner</th>
                        <th>By Status</th>
                        <th>By Platform</th>
                        <th>By Ownership</th>
                        <th class="no-sort"></th>
                    </tr>
                    <tr class="filter-row filter-box">
                        <th class="no-sort"></th>
                        <th data-for="By Device Name"></th>
                        <th data-for="By Owner" class="text-filter"></th>
                        <th data-for="By Status" class="select-filter"></th>
                        <th data-for="By Platform" class="select-filter data-platform"></th>
                        <th data-for="By Ownership" class="select-filter data-ownership"></th>
                        <th class="no-sort"></th>
                    </tr>
                    <tr class="bulk-action-row hidden">
                        <th colspan="7">
                            <div id="operation-bar">
                                {{unit "mdm.unit.device.operation-bar"}}
                            </div>
                            <div id="operation-guide" class="message message-info">
                                <h4 class="remove-margin">
                                    <i class="icon fw fw-info"></i>
                                    Enabling Bulk Operations on Devices
                                </h4>
                                <h5 class="add-padding-top-1x">
                                    To enable bulk operations, select the desired platform and
                                    ownership from above filter.
                                </h5>
                            </div>
                        </th>
                    </tr>
                </thead>
                <tbody id="ast-container"></tbody>
            </table>
        </div>
        <br class="c-both"/>
        <div id="content-filter-types" style="display: none">
            <div class="sort-title">Sort By</div>
            <div class="sort-options">
                <a href="#">By Device Name<span class="ico-sort-asc"></span></a>
                <a href="#">By Owner</a>
                <a href="#">By Status</a>
                <a href="#">By Platform</a>
                <a href="#">By Ownership</a>
            </div>
        </div>
    {{else}}
        <h1 class="page-sub-title">
            Permission Denied
        </h1>
        <br>
        You are not authorized to view any enrolled device in the system.
    {{/if}}
{{/zone}}

{{#zone "bottomJs"}}
    {{#if permissions.VIEW_DEVICES}}
        {{js "js/device-listing.js"}}
    {{/if}}
{{/zone}}
