{{!
  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 Type Management"}}
{{unit "cdmf.unit.data-tables-extended"}}
{{unit "cdmf.unit.ui.modal"}}

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

{{#zone "navbarActions"}}
    {{#unless isCloud}}
        <li>
            <!--suppress HtmlUnknownTarget -->
            <a href="{{@app.context}}/device-type/add" class="cu-btn">
            <span class="icon fw-stack">
                <i class="fw fw-add fw-stack-1x"></i>
                <i class="fw fw-circle-outline fw-stack-2x"></i>
            </span>
                Create Device Type
            </a>
        </li>
    {{/unless}}
{{/zone}}

{{#zone "content"}}
    {{#if hasDeviceTypes}}
        <div id="loading-content" class="col-centered">
            <input type="hidden" id="can-edit" value="true"/>
            <i class="fw fw-settings fw-spin fw-2x"></i>
            Loading device types . . .
            <br>
        </div>

        <div id="devicetype-table">
            <table class="table table-striped table-hover list-table display responsive nowrap data-table grid-view"
                   id="devicetype-grid">
                <thead>
                <tr class="sort-row">
                    <th>By Device Type Name</th>
                </tr>
                <tr class="bulk-action-row">
                    <th colspan="3"></th>
                </tr>
                </thead>
                <tbody id="ast-container" data-app-context="{{@app.context}}/"></tbody>
            </table>
        </div>

        <div id="content-filter-types" style="display: none">
            <div class="sort-title">Sort By</div>
            <div class="sort-options">
                <!--suppress HtmlUnknownTag -->
                <th>By Device Type name</th>
            </div>
        </div>

    {{else}}

        <div id="user-created-msg" class="container col-centered wr-content">
            <div class="wr-form">
                <p class="page-sub-title">You Haven't created device types yet.</p>
                <br>Please click <b>"Create a Device Type"</b>, if you wish to create a device type.
                <hr/>

                <a href="{{@app.context}}/device-type/add" class="cu-btn-inner">
                        <span class="fw-stack">
                            <i class="fw fw-circle-outline fw-stack-2x"></i>
                            <i class="fw fw-add fw-stack-1x"></i>
                        </span>
                    Create Device Type
                </a>
            </div>
        </div>

    {{/if}}
{{/zone}}

{{#zone "bottomJs"}}
    <!--suppress HtmlUnknownTarget -->
    <script id="devicetype-listing" data-current-user="{{@user.username}}"
            src="{{@page.publicUri}}/templates/devicetype-listing.hbs" type="text/x-handlebars-template"></script>
    {{js "js/devicetype-listing.js"}}
{{/zone}}