{{!
  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.
}}

{{#if deviceTypesList}}
    <div class="row wr-device-board">
        <div class="col-lg-12 wr-secondary-bar">
            <span class="page-sub-title">Device Types</span>
        </div>
    </div>
    <div class="container-fluid">
        <table class="table table-striped table-hover list-table no-operations display responsive nowrap data-table grid-view no-toolbar"
               id="device-type-grid">
            <thead>
            <tr class="sort-row">
                <th class="no-sort"></th>
                <th>By Device Type</th>
                <th class="no-sort"></th>
            </tr>
            </thead>
            <tbody id="ast-container">
            </tbody>
        </table>
    </div>
{{else}}
    <div class="ast-container list-view">
        <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">No device type is available to be displayed.</h3>
            <a href="https://docs.wso2.com/display/IoTS320/Quick+Start+Guide" target="_blank"
               class="btn-operations btn-default">
                <span class="fw-stack">
                    <i class="fw fw-circle-outline fw-stack-2x"></i>
                    <i class="fw fw-document fw-stack-1x"></i>
                </span>
                Quick Startup Guide
            </a>
        </div>
    </div>
{{/if}}
<br class="c-both"/>

{{#if virtualDeviceTypesList}}
    <div class="row wr-device-board">
        <div class="col-lg-12 wr-secondary-bar">
            <span class="page-sub-title">Virtual Device Types</span>
        </div>
    </div>
    <h3 style="margin-left: 10px;">Don't have a device?</h3>
    {{#each virtualDeviceTypesList}}
        <div class="try-device-container" id="{{deviceTypeName}}">
            <div class="message message-info try-device-message">
                <p class="try-device-text">
                    <button id="{{deviceTypeName}}_btn"
                            onclick="location.href='{{@app.context}}/device/{{deviceTypeName}}/enroll?type=virtual'"
                            class="btn btn-default btn-primary">Try
                    </button>
                    our {{deviceTypeLabel}} device
                </p>
                <img class="try-device-image" src="{{thumb}}">
            </div>
        </div>
    {{/each}}
{{/if}}

{{#zone "topCss"}}
    {{css "css/listing-grid.css"}}
{{/zone}}
{{#zone "bottomJs"}}
    <script id="device-listing" data-current-user="{{@user.username}}"
            src="{{@unit.publicUri}}/templates/listing.hbs"
            type="text/x-handlebars-template"></script>
    <script type="text/javascript">
            {{! WARN: DO NOT BLINDLY PASS WHOLE CONTEXT HERE}}
        var clientJsAppContext = "{{{@app.context}}}";
        var deviceTypesList = {{{deviceTypesList}}};
    </script>
    {{js "js/listing.js"}}
{{/zone}}
